﻿<%@ Page Language="C#" MasterPageFile="~/FrameMasterPage.master" AutoEventWireup="true" CodeFile="Contacts.aspx.cs" Inherits="Contacts" Title="Untitled Page" %>

<asp:Content ID="Content1" ContentPlaceHolderID="m_contentBody" Runat="Server">

       <body>

   <table  class="GridItem" cellspacing="2" cellpadding="2" style="width:100%;height:auto">
        <br />
        
         <tr>
              <td style="width:400px" colspan ="2" ><strong> <asp:Label ID="lblSupplierContact" runat="server" text="Supplier 's contact" Visible ="false"></asp:Label></strong> </td>
              <br />
         </tr>
         <tr>
         <td  colspan ="2">
<div style=" height:auto; width:auto; overflow:auto">
         <asp:GridView ID="grdContact" runat="server" AllowPaging="True" 
                    AllowSorting="True" AutoGenerateColumns="False" BorderStyle="None" 
                    CssClass="GridItem" DataKeyNames="ContactId" DataSourceID="dsContact" 
                    PageSize="15" RowHeaderColumn="EquipmentId" 
                    onselectedindexchanged="grdContact_SelectedIndexChanged" 
                 onrowcommand="grdContact_RowCommand" 
             onrowdatabound="grdContact_RowDataBound">
                   
                    <HeaderStyle BorderStyle="None" CssClass="GridViewHeader" Height="20px" 
                        Width="250px" />
                    <Columns>
                        <asp:CommandField DeleteText="" InsertText="" ShowEditButton="True" 
                            ShowSelectButton="True">
                            <ItemStyle Width="40px" />
                        </asp:CommandField>
                        
                        <asp:ButtonField CommandName="Delete" Text="Delete">
                            <ItemStyle Width="20px" />
                        </asp:ButtonField>
                        <asp:BoundField DataField="ContactId" HeaderText="Nº" ReadOnly="True">
                            <ItemStyle Width="50px" />
                        </asp:BoundField>
                        <asp:TemplateField HeaderText="Phone">
                            <ItemTemplate>
                                <%# Eval("Phone") %>
                            </ItemTemplate>
                            <EditItemTemplate>
                                &nbsp;<asp:TextBox ID="textBox0" runat="server" Text='<%# Bind("Phone") %>' 
                                     Width="95%"></asp:TextBox>
                            </EditItemTemplate>
                        </asp:TemplateField>
                        
                         <asp:TemplateField HeaderText="Fax">
                            <ItemTemplate>
                                <%# Eval("Fax") %>
                            </ItemTemplate>
                            <EditItemTemplate>
                                &nbsp;<asp:TextBox ID="textBox1" runat="server" Text='<%# Bind("Fax") %>' 
                                     Width="95%"></asp:TextBox>
                            </EditItemTemplate>
                        </asp:TemplateField>
                         <asp:TemplateField HeaderText="Position">
                            <ItemTemplate>
                                <%# Eval("Position") %>
                            </ItemTemplate>
                            <EditItemTemplate>
                                &nbsp;<asp:TextBox ID="textBox2" runat="server" Text='<%# Bind("Position") %>' 
                                     Width="95%"></asp:TextBox>
                            </EditItemTemplate>
                        </asp:TemplateField>
                         <asp:TemplateField HeaderText="Email">
                            <ItemTemplate>
                                <%# Eval("Email") %>
                            </ItemTemplate>
                            <EditItemTemplate>
                                &nbsp;<asp:TextBox ID="textBox3" runat="server" Text='<%# Bind("Email") %>' 
                                     Width="95%"></asp:TextBox>
                            </EditItemTemplate>
                        </asp:TemplateField>
                        
                    </Columns>
                    <PagerStyle HorizontalAlign="Center" VerticalAlign="Middle" />
                    <EditRowStyle BackColor="LightGray" />
                    <RowStyle CssClass="AlternativeRowStyle" />
                    <AlternatingRowStyle BackColor="White" CssClass="AlternativeRowStyle" />
</asp:GridView>
</div>
                 <asp:ObjectDataSource ID="dsContact" runat="server" 
                          SelectMethod="GetContactBySupplierId"  
                    TypeName="DirectServiceSupplier" 
                    UpdateMethod="UpdateContacts" 
                 OldValuesParameterFormatString="original_{0}"  >
            
                     <UpdateParameters>
                         <asp:Parameter Name="contactId" Type="Int32" />
                         <asp:Parameter Name="phone" Type="String" />
                         <asp:Parameter Name="fax" Type="String" />
                         <asp:Parameter Name="position" Type="String" />
                         <asp:Parameter Name="email" Type="String" />
                     </UpdateParameters>
            
                     <SelectParameters>
                         <asp:ControlParameter ControlID="lblEquipmentTypeId" Name="supplierId" 
                             PropertyName="Text" Type="String" />
                     </SelectParameters>
                                      
              </asp:ObjectDataSource>
         
       
         </td> 
          <td style="height: 28px"></td>     
     
      </tr>
        
      <tr>
         <td style="height: 28px"></td>
         <td style="height: 28px">
         <asp:Label ID="lblEquipmentTypeId" runat="server" Visible="False" ></asp:Label>
             <asp:TextBox ID="txtHiddenTypeId" runat="server" Visible="False"></asp:TextBox>
          </td>    
      </tr>
      
      <tr>
         <td style="height: 28px"></td>
         <td style="height: 28px">
         <asp:Label ID="lblEquipmentType" runat="server"  Visible ="false"></asp:Label></td>    
      </tr>
      
     
      
     
          
  </table>

</body>
              
</asp:Content>

